/**
 * 对象类型
 * @flow
 */

 const obj1: {foo: string, bar: number} = {foo: 'string', bar: 1}

//  ?表示可有可无
 const obj2: {foo?: string, bar: number} = { bar: 1}

//  允许添加任意健值对
const obj3 = {}
obj3.key1 = '1'
obj3.key2 = 2

// 限定对象只能添加字符串类型的健值对
const obj4: {[string]:string} ={}
obj4.key1 = 'a'
obj4.key2 = '2'